<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Carbon;

class CreateOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('orders', function (Blueprint $table) {
            $table->id();
            $table->string('name')->comment('预约姓名');
            $table->string('mobile')->comment('预约手机号');
            $table->string('email')->nullable()->comment('预约邮箱');
            $table->string('address')->comment('预约地址');
            $table->string('content')->nullable()->comment('内容');
            $table->dateTime('overtime')->default(Carbon::now()->modify('+3 days'))->nullable()->comment('订单超时时间');
            $table->enum('status', [-1, 0, 1])->nullable()->default(0)->comment('订单状态：-1=》失败，0=》待办，1=》成功');
            $table->string('remark')->nullable()->default(null)->comment('备注');
            $table->string('result')->nullable()->default('成功')->comment('跟踪结果');
            $table->foreignId('service_id')->nullable()->constrained()->comment('关联服务ID');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('orders');
    }
}
